import 'package:flutter_test/flutter_test.dart';
import 'package:hx_demo/hx_demo.dart';
import 'package:hx_demo/hx_demo_platform_interface.dart';
import 'package:hx_demo/hx_demo_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockHxDemoPlatform
    with MockPlatformInterfaceMixin
    implements HxDemoPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<String?> init(String appKey, String tenantId) {
    return Future.value("");
  }

  @override
  // TODO: implement isLogin
  Future<bool?> get isLogin =>  Future.value(true);

  @override
  Future<bool?> login(String username, String password) {
    return Future.value(true);
  }

  @override
  Future<bool?> logout() {
    return Future.value(true);
  }

  @override
  Future<bool?> register(String username, String password) {
    return Future.value(true);
  }
}

void main() {
  final HxDemoPlatform initialPlatform = HxDemoPlatform.instance;

  test('$MethodChannelHxDemo is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelHxDemo>());
  });

  test('getPlatformVersion', () async {
    // HxDemo hxDemoPlugin = HxDemo();
    MockHxDemoPlatform fakePlatform = MockHxDemoPlatform();
    HxDemoPlatform.instance = fakePlatform;

    expect(await HxDemo.getPlatformVersion(), '42');
  });
}
